metadata for bbc.co.uk (post)ꞌ)   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 3
rs 10
nop 0
1
const unfurl = require('../index.js')
2
const chai = require('chai')
3
const expect = chai.expect
4
chai.use(require('chai-as-promised'))
5
6
let srcs = {
7
  twitter: {
8
    url: 'http://localhost:8080/twitter.html', // https://twitter.com/ocdvids/status/856886314138042368
9
    expected: require('./expected/twitter')
10
  },
11
  bbc: {
12
    url: 'http://localhost:8080/bbc.html', // http://www.bbc.co.uk/news/technology-39441825
13
    expected: require('./expected/bbc')
14
  },
15
  medium: {
16
    url: 'http://localhost:8080/medium.html', // https://medium.freecodecamp.com/the-domain-name-system-dns-is-the-backbone-of-the-internet-heres-how-it-all-works-5706d0afa0fa
17
    expected: require('./expected/medium')
18
  }
19
}
20
21
console.log('srcs', srcs)
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
22
23
describe('input-output', function () {
24
  before(function (done) {
25
    let serveStatic = require('serve-static')
26
    let connect = require('connect')
27
28
    connect().use(serveStatic(__dirname + '/html')).listen(8080, function () {
0 ignored issues
show
Compatibility introduced by
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
29
      console.log('Server running on 8080...')
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
30
      done()
31
    })
32
  })
33
34
  it('should resolve metadata for twitter.com (tweet)', function () {
35
    return expect(unfurl(srcs.twitter.url)).to.be.fulfilled.and.to.eventually.become(srcs.twitter.expected)
36
  })
37
38
  it('should resolve metadata for bbc.co.uk (post)', function () {
39
    return expect(unfurl(srcs.bbc.url)).to.be.fulfilled.and.to.eventually.become(srcs.bbc.expected)
40
  })
41
42
  it('should resolve metadata for medium.com (post)', function () {
43
    return expect(unfurl(srcs.medium.url)).to.be.fulfilled.and.to.eventually.become(srcs.medium.expected)
44
  })
45
})
46